package com.atguigu.servlet;

import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
@WebServlet(value = "/servlet2")
public class Servlet2 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("======");
        System.out.println(getServletContext().getRealPath("/upload"));
        ServletContext servletContext = getServletContext();
        //域对象
        servletContext.setAttribute("username","zhangsan");
        servletContext.setAttribute("username","zhangsan");
        servletContext.removeAttribute("username");
    }
}